def get_formatted_name (first_name, last_name):
    """ return formatted user name"""
    full_name = first_name + last_name
    return full_name.title()

while True:
    print('\nPlease tell me your name:')
    print('Enter "q" at any time to quite')
    f_name = input("First name:")
    if f_name == 'q':
        break

    l_name = input("Last name:")
    if l_name == 'q':
        break
    formatted_name = get_formatted_name(f_name, l_name)

    print('Hello, ' + formatted_name + '!')

def city_country (city, country):
    """ return city and country """
    city_country = city.title() + ' ' + country.title()
    return city_country

while True:
    print('\nPlease tell me city name:')
    print('Enter "q" at any time to quite')
    c_name = input("City name:")
    if c_name == 'q':
        break

    cou_name = input("Country name:")
    if cou_name == 'q':
        break
    formatted_name = get_formatted_name(c_name, cou_name)

    print('Hello, ' + formatted_name + '!')